﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RoomPriceEntity;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.Common;
using System.Data;
using Entity.ProcessResultEntity;
using Arch.Framework.Utility.Serialize;

namespace DataLoader
{
    public class PriceLoader
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="GroupID"></param>
        /// <param name="topNumber"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<PriceEntity> GetPriceList(int GroupID, int topNumber, ref long LastDownloadHistoryID)
        {
            List<PriceEntity> peList = new List<PriceEntity>();
            PriceEntity pe = null;
            ProcessResultHotelEntity tempEntity = null;
            Database db = null;
            db = DatabaseFactory.CreateDatabase("ProductDB_SELECT_pro");
            StringBuilder sqlbuilder = new StringBuilder();
            sqlbuilder.Append(@"SELECT top (@topNumber) *
            from HotelInterfaceDB..Htl_IF_LastDownloadHistory(nolock) where GroupID = @GroupID ") ;
            if (LastDownloadHistoryID != 0)
                sqlbuilder.Append(@"
            and LastDownloadHistoryID >= @LastDownloadHistoryID ");
            sqlbuilder.Append(@" order by LastDownloadHistoryID ");
            DbCommand dbCommand = db.GetSqlStringCommand(sqlbuilder.ToString());
            db.AddInParameter(dbCommand, "@topNumber", DbType.Int32, topNumber);
            db.AddInParameter(dbCommand, "@GroupID", DbType.Int32, GroupID);
            db.AddInParameter(dbCommand, "@LastDownloadHistoryID", DbType.Int64, LastDownloadHistoryID);
            dbCommand.CommandTimeout = 0;
            using (IDataReader idr = db.ExecuteReader(dbCommand))
            {
                while (idr.Read())
                {
                    tempEntity = DeSerializeCache(Convert.ToString(idr["LastDownloadCacheXml"]));
                    foreach (var roomEntity in tempEntity.RoomInfoList)
                    {
                        foreach (var roomPrice in roomEntity.RoomPrice)
                        {
                            pe = new PriceEntity()
                            {
                                Room = roomEntity.Room,
                                Price = roomPrice.PriceAfterTax,
                                Cost = roomPrice.Cost,
                                effectdate = roomPrice.EffectDate,
                                Tax = roomPrice.Tax,
                                Fee = roomPrice.Fee
                            };
                        }
                        peList.Add(pe);
                    }
                    LastDownloadHistoryID = Convert.ToInt64(idr["LastDownloadHistoryID"]);
                }
            }
            return peList;
        }

        public List<PriceEntity> GetPriceList(int HotelID)
        {
            List<PriceEntity> peList = new List<PriceEntity>();
            PriceEntity pe = null;
            ProcessResultHotelEntity tempEntity = null;
            Database db = null;
            db = DatabaseFactory.CreateDatabase("ProductDB_SELECT_pro");
            StringBuilder sqlbuilder = new StringBuilder();
            sqlbuilder.Append(@"SELECT *
            from HotelInterfaceDB..Htl_IF_LastDownloadHistory(nolock) where Hotel = @HotelID ");
            sqlbuilder.Append(@" order by effectdate ");
            DbCommand dbCommand = db.GetSqlStringCommand(sqlbuilder.ToString());
            db.AddInParameter(dbCommand, "@HotelID", DbType.Int32, HotelID);
            dbCommand.CommandTimeout = 0;
            using (IDataReader idr = db.ExecuteReader(dbCommand))
            {
                while (idr.Read())
                {
                    tempEntity = DeSerializeCache(Convert.ToString(idr["LastDownloadCacheXml"]));
                    foreach (var roomEntity in tempEntity.RoomInfoList)
                    {
                        foreach (var roomPrice in roomEntity.RoomPrice)
                        {
                            pe = new PriceEntity()
                            {
                                Room = roomEntity.Room,
                                Price = roomPrice.PriceAfterTax,
                                Cost = roomPrice.Cost,
                                effectdate = roomPrice.EffectDate,
                                Tax = roomPrice.Tax,
                                Fee = roomPrice.Fee
                            };
                            peList.Add(pe);
                        }
                    }
                }
            }
            return peList;
        }

        private ProcessResultHotelEntity DeSerializeCache(string cacheContent)
        {
            ProcessResultHotelEntity hotelCacheList = new ProcessResultHotelEntity();
            if (!string.IsNullOrEmpty(cacheContent))
            {
                XMLSerializer serializer = new XMLSerializer();
                hotelCacheList = serializer.Deserialize<ProcessResultHotelEntity>(cacheContent);
            }
            return hotelCacheList;
        }

        public List<string> GetHotelList(int GroupID, int topNumber)
        {
            List<string> result = new List<string>();
            Database db = null;
            db = DatabaseFactory.CreateDatabase("ProductDB_SELECT_pro");
            StringBuilder sqlbuilder = new StringBuilder();
            sqlbuilder.Append(@"SELECT distinct top (@topNumber) hotel
            from HotelInterfaceDB..Htl_IF_LastDownloadHistory(nolock) where GroupID = @GroupID ");
            DbCommand dbCommand = db.GetSqlStringCommand(sqlbuilder.ToString());
            db.AddInParameter(dbCommand, "@topNumber", DbType.Int32, topNumber);
            db.AddInParameter(dbCommand, "@GroupID", DbType.Int32, GroupID);
            dbCommand.CommandTimeout = 0;
            using (IDataReader idr = db.ExecuteReader(dbCommand))
            {
                while (idr.Read())
                {
                    result.Add(Convert.ToInt32(idr["hotel"]).ToString());
                }
            }
            return result;
        }

        public static IList<ProcessResultHotelEntity> Get_PreparedHotelList(int GroupID
            , string NotRoomTypeCode = ""
            , string RatePlanCode = ""
            , string NotRatePlanCode = ""
            , string RoomTypeCode = "")
        {
            Database db = DatabaseFactory.CreateDatabase("ProductDB_SELECT_pro");
            StringBuilder sb = new StringBuilder();
            sb.Append(@"
SELECT 

A.HotelGroupHotelCode
,A.Hotel 
,A.HotelGroupRoomTypeCode
,A.Room
,A.HotelGroupRatePlanCode
,A.RoomTypePayType
,C.City
,D.Defrecommend
,D.DefRecommend_intl
,D.Def_DeductType
,D.LateReserveTime
,D.Person
,D.Currency

FROM HotelGroup_InterfaceRoomType(nolock) A 
INNER JOIN HotelGroup_InterfaceHotel(nolock) B on A.Hotel = B.hotel
INNER JOIN ProductDB..resource(nolock) C On b.hotel = c.Resource
INNER JOIN ProductDB..RoomType(nolock) D on A.room = D.Room
Where B.GroupID = @GroupID ");
            if (!string.IsNullOrEmpty(NotRoomTypeCode))
            {
                sb.Append(@" and A.HotelGroupRoomTypeCode <> @NotRoomTypeCode ");
            }
            if (!string.IsNullOrEmpty(RoomTypeCode))
            {
                sb.Append(@" and A.HotelGroupRoomTypeCode = @RoomTypeCode ");
            }
            if (!string.IsNullOrEmpty(RatePlanCode))
            {
                sb.Append(@" and A.HotelGroupRatePlanCode = @RatePlanCode ");
            }
            if (!string.IsNullOrEmpty(NotRatePlanCode))
            {
                sb.Append(@" and A.HotelGroupRatePlanCode <> @NotRatePlanCode ");
            }
            sb.Append(@" ORDER BY A.Hotel,A.room ");

            DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString());
            db.AddInParameter(dbCommand, "@GroupID", DbType.Int32, GroupID);
            if (!string.IsNullOrEmpty(NotRoomTypeCode))
            {
                db.AddInParameter(dbCommand, "@NotRoomTypeCode", DbType.AnsiString, NotRoomTypeCode);
            }
            if (!string.IsNullOrEmpty(RoomTypeCode))
            {
                db.AddInParameter(dbCommand, "@RoomTypeCode", DbType.AnsiString, RoomTypeCode);
            }
            if (!string.IsNullOrEmpty(RatePlanCode))
            {
                db.AddInParameter(dbCommand, "@RatePlanCode", DbType.AnsiString, RatePlanCode);
            }
            if (!string.IsNullOrEmpty(NotRatePlanCode))
            {
                db.AddInParameter(dbCommand, "@NotRatePlanCode", DbType.AnsiString, NotRatePlanCode);
            }
            List<ProcessResultHotelEntity> list = new List<ProcessResultHotelEntity>();
            ProcessResultHotelEntity tempEntity = null;
            int tempHotel = 0;
            dbCommand.CommandTimeout = 9999;
            using (IDataReader idr = db.ExecuteReader(dbCommand))
            {
                while (idr.Read())
                {
                    if (tempHotel != Convert.ToInt32(idr["hotel"]))
                    {
                        tempEntity = new ProcessResultHotelEntity()
                        {
                            IsOversea = OverseaEnum.OVERSEA,
                            IsSupportMultiDay = true,
                            City = Convert.ToInt32(idr["city"]),
                            Hotel = Convert.ToInt32(idr["hotel"]),
                            HotelGroupHotelCode = Convert.ToString(idr["HotelGroupHotelCode"]),
                            RoomInfoList = new List<RoomAllInfoEntity>(),

                        };
                    }
                    tempEntity.RoomInfoList.Add(new RoomAllInfoEntity()
                    {
                        Room = Convert.ToInt32(idr["Room"]),
                        RoomTypeCode = Convert.ToString(idr["HotelGroupRoomTypeCode"]),
                        RatePlanCode = Convert.ToString(idr["HotelGroupRatePlanCode"]),
                        //PaymentType = GetPayment(Convert.ToString(idr["RoomTypePayType"])),
                        RoomPolicy = new RoomPolicyEntity()
                        {
                            //PaymentType = GetPayment(Convert.ToString(idr["RoomTypePayType"])),
                            RoomStatus = "N"
                        },
                        DefaultValue = new RoomTypeDefaultEntity()
                        {
                            Def_RoomPerson = Convert.ToInt32(idr["Person"]),
                            Def_Recommend = Convert.ToInt32(idr["Defrecommend"]),
                            Def_Recommend_intl = Convert.ToInt32(idr["DefRecommend_intl"]),
                            Def_LateReserveTime = Convert.ToInt32(idr["LateReserveTime"]),
                            Def_DeductType = Convert.ToString(idr["Def_DeductType"]),
                            Def_Currency = Convert.ToString(idr["Currency"])
                        }
                    });


                    tempHotel = Convert.ToInt32(idr["hotel"]);
                    list.Add(tempEntity);
                }
            }
            return list;
        }

        public static void InsertData(int room, DateTime effectdate, double price)
        {   
            Database db = null;
            db = DatabaseFactory.CreateDatabase("TestData");
            StringBuilder sqlbuilder = new StringBuilder();
            sqlbuilder.Append(@"Insert into PriceCompare values(@Room,@Effectdate,@price1,null,null,null,null)");
            DbCommand dbCommand = db.GetSqlStringCommand(sqlbuilder.ToString());
            db.AddInParameter(dbCommand, "@Room", DbType.Int32, room);
            db.AddInParameter(dbCommand, "@Effectdate", DbType.DateTime, effectdate);
            db.AddInParameter(dbCommand, "@price1", DbType.Double, price);
            dbCommand.CommandTimeout = 0;
            db.ExecuteNonQuery(dbCommand);
        }

        public static List<int> GetChangedRoomList()
        {
            List<int> result = new List<int>() ;
            Database db = null;
            db = DatabaseFactory.CreateDatabase("ProductDB_SELECT_pro");
            StringBuilder sqlbuilder = new StringBuilder();
            sqlbuilder.Append(@"Select distinct room from HotelGroup_InterfaceRoomType(nolock) where HotelGroupRatePlanCode='AgodaPP' ");
            sqlbuilder.Append(Update20140808_Hotel);
            DbCommand dbCommand = db.GetSqlStringCommand(sqlbuilder.ToString());
            using (IDataReader idr = db.ExecuteReader(dbCommand))
            {
                while (idr.Read())
                {
                    int room = Convert.ToInt32(idr["room"]);
                    result.Add(room);
                }
            }
            return result;
        }

        #region la
//        public List<string> GetTotalHotelList(int GroupID, List<string> hotelList)
//        {
//            List<string> result = new List<string>();
//            Database db = null;
//            db = DatabaseFactory.CreateDatabase("ProductDB_SELECT_pro");
//            StringBuilder sqlbuilder = new StringBuilder();
//            sqlbuilder.Append(@"SELECT distinct hotel
//            from HotelInterfaceDB..Htl_IF_LastDownloadHistory(nolock) where GroupID = @GroupID and hotel in (");
//            foreach(var hotel in hotelList)
//            {
//                sqlbuilder.Append (hotel+",") ;
//            }
//            string sql = sqlbuilder.ToString();
//            sql = sql.TrimEnd(',');
//            sql = sql + ")";
//            DbCommand dbCommand = db.GetSqlStringCommand(sql);
//            db.AddInParameter(dbCommand, "@GroupID", DbType.Int32, GroupID);
//            dbCommand.CommandTimeout = 0;
//            using (IDataReader idr = db.ExecuteReader(dbCommand))
//            {
//                while (idr.Read())
//                {
//                    result.Add(Convert.ToInt32(idr["hotel"]).ToString());
//                }
//            }
//            return result;
//        }
        #endregion
        #region HotelList
            const string Update20140808_Hotel = @" And hotel in (421963,404960,418405,402089,410579,418737,611566,609027,407353,408681,419023,400383,628045,610192,609860,638742,626053,611188,653398,406480,626485,627149,418545,422458,609173,644716,400005,403208,422481,424479,423815,414987,405100,397698,399859,401187,404436,627696,625111,648251,399295,399172,403795,405246,640285,646777,418127,408226,403317,420961,627235,609674,631231,413550,647796,401751,420274,423274,402962,626216,648483,655018,422255,406766,398193,612625,401797,631672,406812,611752,422790,407499,409165,626800,650063,421416,442564,453135,398445,624533,400168,404004,618436,405398,617743,405232,640225,407247,402458,632708,420340,405684,627112,403689,626448,405375,416404,417941,405043,404330,407035,618762,649734,657394,627155,616584,654125,403005,635911,611486,403669,617786,633106,402272,616037,639349,647172,405000,402295,418943,402172,407582,404336,420297,405641,407562,404230,609757,399155,411120,417108,611523,609900,622847,401419,397197,407184,628194,632273,405498,407121,408166,635619,628549,422126,398571,631981,653621,418339,647086,418439,424439,623133,637789,420208,422129,637557,619581,628048,610189,652854,419258,404771,403775,624112,405266,405621,404748,618516,636369,415322,625463,405953,404061,609671,656289,401044,405003,401382,622429,632462,406995,624304,654059,417174,405272,627029,631775,403769,647590,648254,401877,424476,626219,628211,609694,401645,415554,400317,631314,399238,626405,652871,407456,627378,631374,620013,626050,634872,421505,413098,406517,404539,411240,625217,411781,423288,397214,406663,403712,624095,609980,646571,423085,401940,631274,644255,626110,622369,405086,407250,627879,410805,414386,629150,609419,615419,646628,402790,407081,418940,631712,631878,403357,422664,632519,420337,404688,636100,626445,644092,400420,406371,401957,644447,652771,646820,405395,400397,402816,420792,616750,645303,404997,405495,422358,399544,420692,628134,625970,634626,654102,628111,631188,644590,658579,452903,626047,634752,644613,405060,417795,628148,623322,413467,631337,399856,406434,406185,636518,422086,617620,418777,404170,659177,401814,419126,628738,643886,646548,453115,405601,631443,633607,610295,654414,628297,610985,615854,442587,659183,652101,404983,407236,420303,403323,403987,637984,399410,643889,401757,418620,424239,442547,617400,422009,423005,413688,628120,635113,405006,415039,640377,639713,646119,652216,399888,421823,631632,412995,645618,419261,397203,407359,627450,628283,408023,627032,626122,401926,419115,424525,401803,627719,609079,412377,422550,623002,414475,654045,421614,399974,442553,623560,644499,617546,634526,656252,647510,420240,421863,404588,399178,628266,623938,647201,646660,416304,612677,626159,403509,643958,411335,405530,407445,406612,401199,452889,637274,626454,634864,652176,648930,422447,405676,652863,399825,415975,610178,630905,655877,406798,627181,628343,609869,609371,407107,418680,626116,400678,397973,407674,617151,610155,628157,418723,405733,406841,407505,609328,634798,401362,400698,418843,403695,404116,407362,424253,416018,625950,400057,626514,625850,422218,652302,656630,403589,404136,622398,620726,632714,609863,648366,405510,407170,631303,634635,422132,649050,646637,406835,421491,423157,631638,644081,421534,648409,409440,399453,628200,638771,614134,626036,652837,401717,402799,417996,626477,654068,407734,627075,630988,631343,633882,617566,400286,407356,400618,403443,644101,401783,402779,647682,402092,617397,647496,420300,403990,408567,424545,622329,406546,422530,627599,640288,639624,644788,421989,405026,406523,418600,402616,635024,442573,399121,647759,647513,623563,420492,614317,455657,442550,644957,406377,405487,406815,623168,422052,402132,624390,418116,407110,399536,631280,412520,624035,624542,609886,423177,626952,622020,644951,653988,408235,627244,638645,646809,647058,399181,407007,637423,624041,631861,421611,402971,405922,421070,625764,405066,404070,622581,612929,626162,399138,423944,405089,622060,652983,398119,421594,422427,404282,408361,617128,611532,400160,406818,421717,610181,631904,637921,625976,637755,400034,637357,409523,627891,618522,609448,623391,405072,414641,632488,406483,412981,413230,405464,637208,631884,656192,407279,402118,407528,399201,623620,420263,412434,609305,626039,612222,646846,406838,407465,627307,635963,609909,418391,399158,624410,626574,626580,628246,626082,405009,418491,405507,424485,400681,628638,418932,421929,609803,638774,626033,648263,423652,442636,420406,609952,657609,406572,405908,401995,418975,610190,413070,643818,407474,423907,628189,423575,611209,422934,403369,407451,403037,627124,610144,402018,637844,626151,405075,407405,424053,626337,635829,399857,615617,626314,648249,403206,628212,613725,609643,652185,655680,658259,655016,416459,403770,628358,626145,612374,420226,403993,632998,609188,647061,402974,403269,400767,625859,633685,640220,657200,658528,397209,632202,422207,401932,628020,632643,417478,400166,402081,406409,638153,638408,609440,422055,406017,407345,408679,627980,609334,417186,422347,399874,409117,413694,631123,403561,405971,619321,626354,421975,423137,413319,403999,416402,422971,402101,609420,625736,624525,652866,401958,624382,626042,623151,626065,637758,407411,646649,407554,418351,424351,627794,422851,626048,623217,615892,631873,408221,422951,402811,406180,611292,399167,407574,622504,626085,638820,405261,403638,628398,419184,399545,403873,404122,631538,619550,424494,418580,643881,635823,609357,399894,404720,418878,612660,402207,410863,413276,423847,423455,406094,397979,402848,630854,627067,413176,644920,647625,418477,406074,635517,640380,404700,404036,628046,631535,618468,624133,625793,644694,404059,400100,399645,617495,398649,405719,405241,401998,403913,424474,418669,406552,402021,424497,404013,627150,413044,404560,645790,418523,424428,616138,655013,407139,401188,418623,626317,422645,628919,637824,411321,626998,634907,418128,398941,405974,404099,403804,622527,628232,633888,634515,658657,397212,399877,417189,404786,405782,405865,634870,622364,635016,657197,407156,405828,420229,646815,420329,404892,421663,622275,413445,407202,628123,634369,402625,407199,398102,418414,633928,423332,413299,405493,404829,627419,628083,402931,625521,418938,397713,627207,638780,634867,654100,405350,418420,407342,644090,618528,623483,624528,421972,400083,627084,423638,402224,643921,402124,402788,452901,631286,632537,622630,626045,409549,646646,421245,424434,639613,619304,647273,422121,637008,404809,399164,628252,613347,626088,420704,617326,612998,399456,401371,402453,609311,626131,657509,403684,398274,626231,632723,619739,654412,422817,403584,612111,625178,634687,609881,617707,404131,623140,635875,401377,404981,421629,403985,403776,629114,410723,614790,405004,627594,645570,656313,418718,422339,421944,407288,417198,402465,424523,610405,627548,634873,622407,401360,401237,653047,636247,401941,422253,406816,402820,627199,656204,411533,628218,405522,399485,404895,612921,609380,612048,645344,405087,413494,417822,413156,626011,609678,612629,405628,422694,610319,634123,637959,611401,625470,407102,424168,629108,624431,609277,626091,442631,632257,442608,633894,647339,648384,647505,418443,402127,622390,610153,635125,404022,627159,423375,613548,626446,626114,423043,652463,404755,398091,406919,637501,614853,617100,646821,404234,404732,402883,404042,618646,405024,404065,420172,609841,609300,626612,629317,631899,643973,644571,400982,405794,397971,406541,609320,625550,407268,628241,645553,626028,418984,453116,617521,632669,654066,638769,626326,412386,402797,399551,442588,620724,626134,622888,647282,422422,407225,403979,410520,628198,610296,643887,418406,402090,399837,628261,633834,415821,416153,632174,609360,612609,406644,627574,616877,626695,634189,628215,628547,616476,408682,622450,628192,414301,627073,632815,611421,404506,401921,609861,651647,401357,416554,624494,632314,639599,648298,421277,405957,442671,623638,624471,410703,623807,634876,646947,404483,628407,405270,656416,648129,646801,631172,610030,640326,614547,619410,418947,402130,407208,638703,404291,419256,408227,403813,417928,631610,648344,648922,655955,418320,417235,421901,653900,658809,405230,627777,632652,417679,626449,403710,421858,626549,623306,625221,405233,422545,400610,405479,410643,626403,416299,611550,646174,402339,406252,628344,417968,418632,402814,623910,403713,410119,422688,631547,610156,651109,404735,410354,623532,416305,625118,644803,648381,649045,404068,627156,405734,609844,409521,626117,625951,646111,402147,402196,413557,622579,403647,625825,644760,405997,405748,403982,422917,628195,626074,402545,406873,399548,452907,617226,612071,609317,658597,407477,406481,410809,423166,406936,633897,639270,653914,406581,406587,627262,404417,621268,398074,402900,402359,421878,424540,610840,623283,418781,631298,635626,610983,610150,609901,417799,404274,404815,617083,652297,402849,404177,407094,453125,618254,631367,626744,418950,403135,407380,417791,402803,633050,631722,401784,418973,632532,400788,632200,402448,610142,626126,617089,650717,402348,424569,418741,618108,656983,397207,421890,405242,610305,637773,640312,611639,611516,647806,401801,404555,404532,421967,636940,405196,402926,407111,418472,397994,404160,417476,402488,647013,406802,407549,626558,632300,626063,646956,407489,626704,637278,424320,399431,631513,609873,400410,627832,630826,611848,421953,619319,609827,405382,639631,647700,404741,626452,634616,653797,399849,627514,626020,611198,627537,628367,609561,647388,401721,406135,610414,623149,628227,637215,622817,406321,413772,423092,623790,653076,408027,403550,405637,609326,420344,417639,420221,404114,406819,627202,424131,623833,612595,402013,401266,410420,442637,635678,409673,413088,612615,406484,410314,406447,616551,412982,420201,627308,404220,645957,421887,399165,402952,609306,630995,413231,406925,645167,411253,647325,409238,632326,638775,619342,652300,421781,406633,615904,611327,639708,405110,418143,421930,422471,638526,626083,420327,400098,424595,618420,618752,624039,631865,421369,608742,624563,655698,398415,422342,400407,442617,623544,626077,399265,626100,658732,406404,407068,405886,411714,421870,637630,610995,610162,625064,626146,413042,621815,653614,397204,413311,402614,424426,628284,610185,647686,398100,406258,422242,623690,400994,401787,402783,634527,399474,401303,405239,420473,399288,452896,399866,631905,401933,403510,404097,422737,628768,612037,637175,653153,406072,403218,402969,407546,417871,407051,632552,620896,648287,623206,407987,424489,406822,420267,399162,421927,415478,413769,422972,406109,626043,404970,406467,406985,638778,653508,401014,402763,405093,407506,416660,418160,420241,398186,406842,634673,657985,403029,418724,402863,400201,437536,626166,402886,414957,617487,406301,415621,404950,631284,612718,398017,406673,402345,407171,632180,657899,647726,631304,404217,401220,421592,422219,414559,401575,651221,418581,610199,401369,631490,645605,648267,400387,417456,628393,404715,424881,617673,622542,404864,622001,638772,649641,419165,406098,422414,628356,405789,406453,442620,630918,401166,403396,399151,417459,617496,628402,404724,612086,626481,624466,399337,405743,612232,625462,647520,422583,424498,628187,636351,418670,635017,398086,418355,403250,617141,627174,656265,401730,399145,412055,616408,403745,413778,424598,628210,423147,618177,611562,655014,423333,399523,618283,612627,658409,420476,399832,402832,623547,609438,626049,403814,422291,631313,422600,610019,647606,406516,627191,411425,647752,397754,400416,409410,422892,399088,424515,628170,403705,609979,413197,631127,625176,401644,418215,623650,407495,634370,625468,406513,627443,628439,649166,627586,401650,407721,619571,609418,638804,403997,616892,626089,405520,399520,627108,399022,631187,646584,407578,629172,647437,421624,402148,404973,402809,613995,631897,626069,652704,403622,398089,417565,399712,404163,626046,632120,416420,626026,625777,406496,404953,399463,453108,626418,621555,417794,405892,628731,611419,405165,422477,628253,632667,612060,623962,639614,654221,646647,405016,421830,421836,631685,614871,646833,400588,404375,406041,398418,631293,423894,632332,610151,653431,407223,632724,624068,399208,631542,636952,627214,657510,404936,418003,400691,404604,421916,627194,618704,644506,655913,647755,401664,418312,424478,628213,648064,418713,610500,623567,420373,610168,626484,626152,623235,406788,638200,656053,399858,419168,405437,617539,638764,405076,402420,617639,423390,625674,413234,617662,618326,624400,631725,609667,399835,403376,635538,618472,652850,398112,406602,423831,627188,402334,403662,617098,638701,415318,656345,650062,655017,418126,402975,412802,609922,626985,649707,397210,402829,631376,422895,632249,422002,442563,626112,410595,404541,402875,609335,640221,397757,420479,400167,422102,403708,627042,628173,625173,626501,634911,646813,405019,402102,421833,614874,628250,623885,410615,611436,407389,424369,630812,634891,615160,405374,630835,633872,631353,612126,400422,404209,407412,646650,421621,402145,402812,404309,422288,624151,637802,646630,404999,644735,404764,633603,420167,634599,406436,646836,402002,609899,398172,452905,622883,659179,401810,401232,630898,622989,413220,652289,422231,626962,645319,405846,418836,442640,401269,423164,631104,626029,634934,418687,423064,624463,624506,637496,609856,611479,609358,414402,626129,405062,421043,632478,626819,646544,405454,400044,610148,622591,399861,633858,638767,612965,626032,654087,405008,423316,627383,628262,402801,609075,399174,623493,627575,628070,609430,626742,656457,610449,611236,417929,401945,401281,407192,637602,413020,611213,654250,647758,424527,628139,418576,611491,646779,397992,409399,611760,625823,646802,421942,408712,405171,636915,625554,442549,405025,403697,401444,627283,626951,634528,644595,401195,422111,399180,407338,412164,405334,413160,617110,401241,423880,622411,418553,628657,609344,644641,414534,414866,419194,633048,637917,402177,639331,639245,626450,404939,409416,405918,610864,634668,647449,405234,414477,406313,631319,609925,625076,405921,404544,415659,418513,414268,616131,417279,418988,623270,614565,622225,402483,610512,413060,609845,611176,626161,631903,624907,653792,420362,611531,626138,634794,401364,609304,626118,609132,619377,647509,610157,613526,418968,610678,619334,632736,625826,632046,638710,612152,658604,418092,623619,638773,634445,653417,417451,623725,639414,631883,656726,407478,406482,407229,399904,626075,658206,402546,409579,648319,658647,402111,399947,610300,421587,410518,644432,404418,403385,404424,618315,623184,635670,652982,421879,424882,422128,630901,647970,654213,646639,647721,657459,402011,617525,622394,637001,609902,401616,402944,452888,617376,630775,613131,404959,405506,418951,421822,407166,420611,627217,620934,404295,612444,421630,403322,403986,405815,406479,404487,614837,625156,406333,421776,403468,399864,405028,636108,609049,421676,654422,647592,399887,640453,418719,406648,408563,402735,630990,417368,401802,424524,623513,621767,626390,647784,655481,618378,409519,626785,615129,609888,610220,624532,631113,421613,401301,631717,421945,626098,611110,619268,399323,402572,406897,631316,416635,633984,404587,420866,442506,630921,647655,417425,420425,423674,629201,617794,644598,417182,655418,405377,417531,402088,417869,633237,611256,609928,442609,418364,412167,626058,644452,406442,418679,399944,632613,420173,622368,422260,626115,611720,442632,631545,400465,415619,655521,647695,405397,405068,421049,627160,633231,406728,652464,405091,399472,610154,408128,404856,413014,631282,615962,610134,617124,404215,398092,609321,635959,422211,417468,407063,415719,421719,610675,400156,616752,628654,405417,628013,628136,614611,404925,405466,622603,625849,421839,627117,618710,626121,406293,652195,407232,418138,637645,645554,610091,616340,651711,646636,417952,418493,418530,402841,406542,611322,626974,405111,424338,402941,420259,627950,608723,610887,623871,625537,658252,405254,415533,402549,632129,632670,626135,651654,646785,421633,417554,399160,628740,633068,413226,424438,647034,421679,399126,413853,610309,644601,655012,412170,632553,442618,423385,416083,404722,455662,626101,417935,404536,626124,634946,644438,405887,407092,622526,610163,626147,416584,401997,423391,397746,407238,627498,413235,625088,407384,417958,637800,418499,616947,632267,610332,621816,633781,613220,417334,417666,401350,404350,633887,624936,417474,402830,421307,631325,647641,421616,453129,632261,609330,404785,406113,622466,397955,616715,414918,632012,625815,649662,400414,401742,423723,627335,644647,631912,650057,398101,404593,407052,418708,402970,627189,627435,618484,408380,626107,413003,421928,424347,420268,627704,622629,626708,638779,634866,397975,405469,626565,406986,422475,399163,628251,612762,625168,628414,654219,422120,612785,638802,613781,402123,631454,406700,623960,408715,623147,626018,626024,625477,625852,646625,405492,623170,657302,420368,421622,407507,404802,609914,625234,626144,644587,407278,402950,627959,418625,400686,405512,397981,413670,631434,412674,421971,651222,406972,407513,401513,415542,618699,404181,612662,399853,637193,407613,609310,424533,631348,628643,627020,418980,413813,408011,417749,423159,628394,611082,613246,407450,402303,618278,623565,626436,623233,420471,628165,405744,402140,402349,407281,622377,616804,626960,653681,628188,626977,623024,405051,631182,634803,653781,405074,405243,421058,626413,650810,406425,421868,405761,404015,414589,636300,652948,397958,423428,402867,637611,410444,423096,398041,621876,408131,637219,625231,653904,397912,406909,408237,424470,627332,612095,403554,413501,412960,422933,405034,406611,407696,614551,634863,410590,405721,623694,609333,622815,635012,403660,422641,635991,637319,421954,399183,609041,413106,611222,421453,407344,622440,407155,639489,407132,413132,625523,643880,654196,631288,632705,609891,609393,624547,634869,652181,656758,403594,411758,609376,609868,452880,398997,413063,416309,402220,405515,410384,631308,407679,610701,626021,419183,414357,418685,654259,407467,406840,633223,609911,405844,659191,401908,404327,630747,626419,646977,420202,418542,414214,422907,631351,628646,398127,638776,410613,413026,405260,422080,411211,619692,644627,609854,610097,656970,417995,405552,422372,401224,406093,422323,631886) ";
        #endregion
    }
}
